#include <iostream>
#include <vector>
using namespace std;

class Solution {
public:
    int removeDuplicates(vector<int> &nums) {
        int k = 2;
        if (nums.size() <= 2) return nums.size();
        for (int i = 2; i < nums.size(); i++)
        {
            if (!(nums[k - 1] == nums[k - 2] && nums[i] == nums[k - 1]))
            {
                // 删除元素
                nums[k++] = nums[i];
            }
        }
        return k;
    }
};

int main(){
    
    return 0;
}